Handle invalid stdio JSON-RPC requests without leaving clients waiting#1795
Closed
raashish1601 wants to merge 2 commits intomodelcontextprotocol:mainfrom
Closed
Handle invalid stdio JSON-RPC requests without leaving clients waiting#1795raashish1601 wants to merge 2 commits intomodelcontextprotocol:mainfrom
raashish1601 wants to merge 2 commits intomodelcontextprotocol:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 4e18bce The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@modelcontextprotocol/client
@modelcontextprotocol/server
@modelcontextprotocol/express
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
Contributor
|
Per discussion on #1765: precision loss happens at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1765.
Summary
StdioServerTransportemit anInvalid RequestJSON-RPC error response for those malformed request lines and then continue processing subsequent inputValidation
corepack pnpm --filter @modelcontextprotocol/core exec vitest run test/shared/stdio.test.tscorepack pnpm --filter @modelcontextprotocol/server exec vitest run test/server/stdio.test.tscorepack pnpm --filter @modelcontextprotocol/core run typecheckcorepack pnpm --filter @modelcontextprotocol/server run typecheckcorepack pnpm exec prettier --check packages/core/src/shared/stdio.ts packages/core/test/shared/stdio.test.ts packages/server/src/server/stdio.ts packages/server/test/server/stdio.test.tscorepack pnpm exec eslint src/shared/stdio.ts test/shared/stdio.test.ts(frompackages/core)corepack pnpm exec eslint src/server/stdio.ts test/server/stdio.test.ts(frompackages/server)Notes
pnpm --filter ... run lintcommands still fail on existing package-wide Prettier drift in untouched files, so validation stayed focused to the touched files plus the relevant typechecks and tests.